package org.kotboot.service;

import org.kotboot.dao.DictDao;
import org.kotboot.dao.UserDao;
//import org.kotboot.domain.Dictkt;
import org.kotboot.domain.User;
import org.kotboot.kit.SMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * jisong.sun 2017/9/14 17:23
 */
@Service
public class UserServ {

    @Resource
    DictDao dictDao;
    @Resource
    UserDao userDao;

    private static Logger log  = LoggerFactory.getLogger(UserServ.class);

//    public int calc(int id ){
//        log.info("userServ log , id = $id");
//        return id;
//    }
//
//    public Dictkt select(String k){
//        SMap map = new SMap();
//        map.put("k",k);
//        Dictkt dict  = dictDao . queryObject (map);
//        log.info("db result :{}",dict);
//        return dict;
//    }
//
//    public Dictkt query(String v){
//        SMap map = new SMap();
//        map.put("v",v);
//        Dictkt dict = dictDao.queryByMobile(map);
//        log.info("db result :{}",dict);
//        return dict;
//    }
//
//    public int insert(Dictkt dict){
//        int res = dictDao.save(dict);
//        log.info("db result :{}",res);
//        return res;
//    }

    public User findByMob(String mobile) {
        User daoUser = new User();
        daoUser.setMobile(mobile);
        User user = userDao.findByCondition(daoUser);
        return user;
    }

    public User findByMail(String email){
        User daoUser = new User();
        daoUser.setEmail(email);
        User user = userDao.findByCondition(daoUser);
        return user;
    }


}
